package vip.bblog.cunadmin.modules.system.controller;


import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import vip.bblog.cunadmin.common.entity.BaseResult;
import vip.bblog.cunadmin.common.entity.PageResult;
import vip.bblog.cunadmin.modules.system.dto.SysLogParams;
import vip.bblog.cunadmin.modules.system.entity.SysLog;
import vip.bblog.cunadmin.modules.system.service.SysLogService;

import java.util.List;


/**
 * <p>
 * 操作日志 * </p>
 *
 * @author yy
 */
@Api(tags = "web:操作日志")
@ApiSort(1)
@RestController
@RequestMapping("/sysLog")
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;

    @ApiOperation(value = "刪除信息")
    @PreAuthorize("hasAnyAuthority('sys:sysLog:del')")
    @DeleteMapping("{id}")
    public BaseResult<SysLog> delete(@PathVariable Integer id) {
        sysLogService.removeById(id);
        return BaseResult.success();
    }

    @ApiOperation(value = "分页查询")
    @PreAuthorize("hasAnyAuthority('sys:sysLog:list')")
    @GetMapping
    public PageResult<List<SysLog>> listPage(SysLogParams params) {
        return sysLogService.listPage(params);
    }

}

